package com.ruoyi.deeplearn.service.impl;

import java.util.List;

import cn.hutool.core.util.IdUtil;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.deeplearn.mapper.DeepModuleNetMapper;
import com.ruoyi.deeplearn.domain.DeepModuleNet;
import com.ruoyi.deeplearn.service.IDeepModuleNetService;

/**
 * 模型网络Service业务层处理
 *
 * @author rww
 * @date 2024-09-04
 */
@Service
public class DeepModuleNetServiceImpl implements IDeepModuleNetService
{
    @Autowired
    private DeepModuleNetMapper deepModuleNetMapper;

    /**
     * 查询模型网络
     *
     * @param id 模型网络主键
     * @return 模型网络
     */
    @Override
    public DeepModuleNet selectDeepModuleNetById(Long id)
    {
        return deepModuleNetMapper.selectDeepModuleNetById(id);
    }

    /**
     * 查询模型网络列表
     *
     * @param deepModuleNet 模型网络
     * @return 模型网络
     */
    @Override
    public List<DeepModuleNet> selectDeepModuleNetList(DeepModuleNet deepModuleNet)
    {
        return deepModuleNetMapper.selectDeepModuleNetList(deepModuleNet);
    }

    /**
     * 新增模型网络
     *
     * @param deepModuleNet 模型网络
     * @return 结果
     */
    @Override
    public int insertDeepModuleNet(DeepModuleNet deepModuleNet)
    {
        deepModuleNet.setId(IdUtil.getSnowflakeNextId());
        deepModuleNet.setCreateTime(DateUtils.getNowDate());
        return deepModuleNetMapper.insertDeepModuleNet(deepModuleNet);
    }

    /**
     * 修改模型网络
     *
     * @param deepModuleNet 模型网络
     * @return 结果
     */
    @Override
    public int updateDeepModuleNet(DeepModuleNet deepModuleNet)
    {
        deepModuleNet.setUpdateTime(DateUtils.getNowDate());
        return deepModuleNetMapper.updateDeepModuleNet(deepModuleNet);
    }

    /**
     * 批量删除模型网络
     *
     * @param ids 需要删除的模型网络主键
     * @return 结果
     */
    @Override
    public int deleteDeepModuleNetByIds(Long[] ids)
    {
        return deepModuleNetMapper.deleteDeepModuleNetByIds(ids);
    }

    /**
     * 删除模型网络信息
     *
     * @param id 模型网络主键
     * @return 结果
     */
    @Override
    public int deleteDeepModuleNetById(Long id)
    {
        return deepModuleNetMapper.deleteDeepModuleNetById(id);
    }

    @Override
    public int configDeepModuleNet(DeepModuleNet deepModuleNet) {
        //修改配置模型
        updateDeepModuleNet(deepModuleNet);
        return 1;
    }
}
